<?php
class Pageley_Serializer_Converter_Enumeration implements Pageley_Serializer_Converter {

    private $attribute;

    public function __construct($attribute) {
        $this->attribute = $attribute;
    }

    public function convertIntoFormat($value) {
        return $value != null ? $value->getName() : null;
    }

    public function convertFromFormat($value) {
        return $value != null ? $this->attribute->valueOf($value) : null;
    }
}